--隐迹无形
local yingjiwuxing = fk.CreateSkill {
    name = "mcdh_yingjiwuxing",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

yingjiwuxing:addEffect(fk.DamageInflicted,{
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(self)  and data.from and not data.from:isKongcheng() and target == player
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        return room:askForSkillInvoke(player, self.name, nil, "#mcdh_yingjiwuxing-invoke:" .. data.from.id)
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local card = room:askForCardChosen(data.from, data.from, "h", self.name, "#mcdh_yingjiwuxing-show")
        data.from:showCards(card)
        local discard =room:askForDiscard(player, 1, 1, true, self.name, true, ".|.|"..Fk:getCardById(card):getSuitString(), "#mcdh_yingjiwuxing-discard:::"..Fk:getCardById(card):getSuitString(true))
        if #discard > 0 then
            data.damage = data.damage -1
        end
    end
})

Fk:loadTranslationTable {
    ["mcdh_yingjiwuxing"] = "隐迹无形",
    [":mcdh_yingjiwuxing"] = "『隐迹无形』<br>当你受到伤害时，你可以令伤害来源展示一张手牌，然后你可以弃置一张与此牌花色相同的牌并令此伤害-1。",
    ["#mcdh_yingjiwuxing-invoke"] = "隐迹无形：令伤害来源展示一张手牌，然后你可以弃置一张与此牌花色相同的牌并令此伤害-1。",
    ["#mcdh_yingjiwuxing-show"] = "隐迹无形：展示一张手牌",
    ["#mcdh_yingjiwuxing-discard"] = "隐迹无形：弃置一张 %arg 牌并令此伤害-1。"
}

return yingjiwuxing